/**
 * Copyright (c)  HeiFeiDeFengZheng.Co.Ltd. All rights reserved.
 **/
package com.defu.studentmanage.common;

import lombok.Data;
import org.omg.CORBA.PUBLIC_MEMBER;

/**
 * 功能描述：
 *
 * @author huifeidefengzheng
 * @since 2024-01-24
 *
 **/
@Data
public class Result {

    private String code;
    private String msg;
    private Object data;
    private Result(Object data) {
        this.data = data;
    }
    public Result() {

    }

    private static Result result(String code, String msg, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setData(data);
        result.setMsg(msg);
        return result;
    }

    public static Result success() {
        return result("200", "success", null);
    }

    public static Result success(Object data){
        return result("200", "success", data);
    }

    public static Result success( String msg){
        return result("200", msg, null);
    }

    public static Result success(Object data, String msg){
        return result("200", msg, data);
    }

    public static Result fail(String msg){
        return result("500", msg, null);
    }
}
